<%@page contentType="text/html; charset=utf-8" language="java" import="cn.ac.cintcm.synonymous.*"  errorPage="" %>
<%@page import="java.util.List,java.sql.*,net.sf.json.*" %>
<%
Connection conn = OracleDb.getConnection();
NameFieldDao  categoryDao = new NameFieldDao(conn, NameFieldDao.CATEGORY);
NameFieldDao  sourceDao = new NameFieldDao(conn, NameFieldDao.SOURCE);
NameRecordDao recordDao = new NameRecordDao(conn, categoryDao, sourceDao);
List overViews = null;
String tableId = request.getParameter("tableId");
short id = 1;
if (tableId != null) {
    id = Short.valueOf(tableId) ;
}
try {
    overViews = recordDao.getCategoryOutline(id);
    if (overViews != null) {
        /*StringBuilder outb = new StringBuilder();
        for (int i=0; i<overViews.size(); i++){
            OverView ov = (OverView) overViews.get(i);
            outb.append(ov.getId());
            outb.append(":");
            outb.append(ov.getName());
            outb.append(":");
            outb.append(ov.getCount());
            outb.append(";");
        }
        outb.deleteCharAt(outb.length() - 1);
        out.write(outb.toString());
         */
        JSONArray jsonArray = JSONArray.fromObject(overViews) ;
        out.write(jsonArray.toString());
    }
    conn.close();
} catch (SQLException e) {
    e.printStackTrace();
}
%>